﻿@{
    Layout = null;
    string qr_guid = Request["qr_guid"];
    string qr_timeStamp = Request["qr_timestamp"];
    string qr_signature = Request["qr_signature"];
    string bbsName = this.ViewContext.RouteData.Values["BBSName"].ToString();
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>ConfirmVisit</title>
</head>
<body>
    <div>
        <input id="btn_confirm" type="button" value="确认授权" />
    </div>
    <script src="/static/global/gmu/dist/zepto.min.js"></script>
    <script src="/static/global/gmu/src/extend/selector.js"></script>
    <script src="/static/global/gmu/src/extend/compatibleIE9.js"></script>
    <!-- 公用js begin -->
    <script type="text/javascript" charset="utf-8" src="/static/BenzBBS/js/script.js"></script>
    <!-- 公用js begin -->
    <script type="text/javascript">
        var pars = utility.getQueryString();
        var ws = new WebSocket("ws://192.168.1.91:8888");
        ws.onopen = function () {
            
        }
        ws.onmessage = function () {

        }
        ws.onerror = function () {

        }
        ws.onclose = function () {

        }
        $("#btn_confirm").click(function () {
            $.ajax({
                type: "POST",
                url: "/bbs/@bbsName/accesstovisit",
                //data: { qr_guid: "@qr_guid", qr_timestamp: "@qr_timeStamp", qr_signature: "@qr_signature" },
                data: { qr_guid: pars.qr_guid, qr_timestamp: "@qr_timeStamp", qr_signature: "@qr_signature" },
                dataType: "json",
                success: function (objInvokeResult) {
                    if (objInvokeResult.ResultCode == "Success") {
                        //alert(objInvokeResult.ResultMessage);
                        ws.send(JSON.stringify({
                            Type: "SendToID",
                            SendToID: pars.qr_guid,
                            Content: JSON.stringify({
                                Result: "Success",
                                Data: objInvokeResult.Data
                            })
                        }))
                    }
                }
            });
        });
    </script>
</body>
</html>
